package com.cy.pj.common.pojo;

/**
 * 基于此对象封装服务器端响应到客户端的数据
 */
public class JsonResult {

    private Integer state;//响应状态码(有的人用code) //1表示ok,0表示error,
    private String message="ok";//状态码对应的信息
    private Object data;//正确的响应数据

    public JsonResult(){}//无参构造方法

    public JsonResult(String message){
        this.message=message;
    }
    public JsonResult(Object data){
        this.data=data;
    }
    public JsonResult(Throwable e){
        this.state=0;
        this.message=e.getMessage();
    }

    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
